<template>
  <div>
    <van-search
      v-model="keyword"
      show-action
      placeholder="请输入搜索关键词..."
      @search="onSearch"
      clearable
    >
      <template #action>
        <div @click="onSearch(keyword)">搜索</div>
      </template>
    </van-search>
  </div>
</template>
<script>
export default {
  data() {
    return {
      keyword: "",
      searchResult:[]
    };
  },
     
  methods: {
    onSearch(keyword) {
      if(keyword.trim()==''){
         this.$notify({type: 'warning',message:'搜索内容不能空'});
      }else{
        this.$router.push(`/search?keyword=${keyword}`);
       location.reload()
      }
    },
    
  },
};
</script>
<style></style>
